<template>
	<view class="loginContainer">
		<view class="logoContainer">
			<image class="logo" src="//yanxuan.nosdn.127.net/39c5e4583753d4c3cb868a64c2c109ea.png" mode=""></image>
			<p class="text">网易自营，精品生活家居品牌</p>
		<div class="loginMethods">
			<!-- 首次用户授权 必须使用button实现 -->
			<button type="default" open-type="getUserInfo" @getuserinfo="getUserInfo" class="login wechatLogin">
				微信登录
			</button>
			<button class="login">
				邮箱登录
			</button>
		</div>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			};
		},
		methods:{
			getUserInfo(res){
				// let rawData =res.detail.rawData
				let {rawData} = res.detail
				console.log(rawData);
				if(rawData){
					//如果授权成功，将用户信息存储至storage
					uni.setStorage({
						key:"userInfo",
						data:rawData
						
					})
					//关闭所有页面，打开指定页面，指定页面会被重新挂载
					uni.reLaunch({
						url:"/pages/personal/personal?userinfo="+rawData
					})
					
				}
			}
		}
	}
</script>

<style lang="stylus">
	.loginContainer
		.logoContainer
			width 80%
			height 800upx
			text-align center
			position fixed
			top 50%
			left 50%
			transform translate(-50%,-50%)
			.logo
				width 280upx
				height 80upx
			.text
				font-size 24upx
				color #808080
			.loginMethods
				display flex
				transform translateY(150upx)
				.login
					width 200upx
					height 80upx
					line-height 80upx
					background-color #389a62
					font-size 24upx
					color #fff
				
			
</style>
